package com.wzc.bigevent.controller;


import com.wzc.bigevent.pojo.Result;
import com.wzc.bigevent.service.UploadService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/upload")
@Slf4j
public class UploadController {

    @Resource
    private UploadService uploadService;

    /**
     * 文件上传
     * 请求路径： /upload
     * 请求方式： POST
     * 请求参数： MultipartFile file
     *
     * @return
     */
    @PostMapping()
    public Result upload(@RequestParam MultipartFile file){
        // 文件上传
        return uploadService.upload(file);
    }
}
